<template>
	<view class="contract-page full box relative p-safe">
		<view class="image-item" v-for="(item,index) in hetong_image_list" :key="index"
			@click="handlePreviewImage(index)">
			<image :src="item" mode="widthFix" show-menu-by-longpress></image>
		</view>
	</view>
</template>

<script>
	import { request, showLoading } from '@/utils/tool';

	export default {
		data() {
			return {
				hetong_image_list: []
			}
		},
		created() {
			this.initData()
		},
		methods: {
			handlePreviewImage(index) {
				wx.previewImage({
					urls: this.hetong_image_list,
					current: index
				})
			},
			async initData() {
				const hide = showLoading("正在获取")
				const resp = await request({
					url: "/user/gethetonglist",
					method: "GET"
				}).finally(hide)
				const data = resp.data
				if (data) {
					this.hetong_image_list = data.hetong_image_list || []
				}
				console.log(resp);
			}
		},
	}
</script>

<style lang="scss" scoped>
	.contract-page {
		.image-item {
			display: flex;

			image {
				width: 100%;
			}
		}
	}
</style>